import request from "@/utils/request";
import { DeparmentResponseData, HospitalDetail, HospitalWordData, LoginData, UserLoginResponseData, UserResponseData, DoctorInfoData, DoctorResponseData } from "./type";

enum API {
  // 获取医院详情信息
  HOSPITALDETAIL_URL = '/hosp/hospital/',
  // 获取科室信息
  HOSPITALDEPARTMENT_URL = '/hosp/hospital/department/',
  // 获取验证码
  GETUSERCOODE_URL = '/sms/send/',
  // 用户登录接口
  USERLOGIN_URL = '/user/login/',
  // 获取医院科室信息
  HOSPITALWORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
  //获取医院某一个科室某一天相应医生排班的数据
  HOSPITALDOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
  //获取某一个账号下就诊人的信息
  GETUSER_URL = '/user/patient/auth/findAll',
  //获取挂号医生的信息
  GETDOCTOR_URL = '/hosp/hospital/getSchedule/'
}

export const reqHospitalDetail = (hoscode: string) => request.get<any, HospitalDetail>(
  API.HOSPITALDETAIL_URL + hoscode
)

export const reqHospitalDepartment = (hoscode: string) => request.get<any, DeparmentResponseData>(
  API.HOSPITALDEPARTMENT_URL + hoscode
)

export const reqGetCode = (phone: string) => request.get<any, any>(
  API.GETUSERCOODE_URL + phone
)

export const reqUserLogin = (data: LoginData) => request.post<any, UserLoginResponseData>(
  API.USERLOGIN_URL, data
)

export const reqHospitalWork = (page: number, limit: number, hoscode: string, depcode: string) => request.get<any, HospitalWordData>(
  API.HOSPITALWORK_URL + `${page}/${limit}/${hoscode}/${depcode}`
)

//获取医生排班的数据
export const reqHospitalDoctor = (hoscode: string, depcode: string, workDate: string) => request.get<any, DoctorResponseData>(
  API.HOSPITALDOCTOR_URL + `${hoscode}/${depcode}/${workDate}`
)

//获取某一个账号下就诊人信息
export const reqGetUser = () => request.get<any, UserResponseData>(
  API.GETUSER_URL
)

//获取挂号医生的信息
export const reqDoctorInfo = (scheduleId: string) => request.get<any, DoctorInfoData>(
  API.GETDOCTOR_URL + scheduleId
)